<?php

namespace app\api\validate;

use think\Validate;

class OrderValidate extends Validate
{
    protected $rule = [
        'goods_id' => 'requireWithout:sku_id|integer',
        'sku_id' => 'requireWithout:goods_id|integer',
        'payment_type' => 'require|integer',
        'buy_num' => 'integer',
        'receiver_name' => 'requireWithout:logistics_mode|max:30',
        'receiver_phone' => 'requireWithout:logistics_mode|mobile',
        'province' => 'requireWithout:logistics_mode|max:30',
        'city' => 'requireWithout:logistics_mode|max:30',
        'county' => 'requireWithout:logistics_mode|max:30',
        'address' => 'requireWithout:logistics_mode|max:100',
    ];

    protected $message = [
        'goods_id.requireWithout' => '非法请求!',
        'sku_id.requireWithout' => '非法请求!',
        'receiver_name.require' => '收货人不能为空!',
        'receiver_phone.require' => '收货人手机号不能为空!',
        'receiver_phone.mobile' => '请输入正确的收货人手机号!',
        'province.require' => '所在省份不能为空!',
        'city.require' => '所在城市不能为空!',
        'county.require' => '所在县或市区不能为空!',
        'address.require' => '详细地址不能为空!',
    ];

   

    public function sceneFree()
    {
        return $this->only(['goods_id','sku_id','receiver_name','receiver_phone','province','city','county','address']);
    }
}